/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package towerdefence;

import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JPanel;
import towerdefence.model.color.ColorCreator;
import towerdefence.model.color.RandomColorCreator;

/**
 *
 * @author Gussoh
 */
public class TestColorCreator {
    public static void main(String[] args) {
        new TestColorCreator();
    }

    public TestColorCreator() {
        JFrame jf = new JFrame("Color Tester");
        jf.add(new ColorPanel());
        jf.pack();
        jf.setDefaultCloseOperation(3);
        jf.setVisible(true);
    }
    
    
    public class ColorPanel extends JPanel {

        ColorCreator cc = new RandomColorCreator();
        
        public ColorPanel() {
            setPreferredSize(new Dimension(500, 500));
            
        }

        @Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            for (int x = 0; x < getWidth(); x += 10) {
                for (int y = 0; y < getHeight(); y += 10) {
                    g.setColor(cc.getNextColor());
                    g.fillRect(x, y, 10, 10);
                }
            }
        }
    }
}
